package com.rpframework.website.device.act.api;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import javax.swing.plaf.synth.SynthSeparatorUI;

public class DTTimeUtils {
   public  static Integer StringToTime(String year,String day) throws ParseException{
	   String s=year+"-"+day;
	   SimpleDateFormat sdf =   new SimpleDateFormat( "yyyy-MM-dd" );
		Date date = (Date) sdf.parse(s);
		long time=date.getTime()/1000;
	    return (int) time;
   }
   
   
   public static Integer monthFirstDayTime() throws ParseException {
	   Calendar c = Calendar.getInstance();    
	   c.add(Calendar.MONTH, 0);
	   c.set(Calendar.DAY_OF_MONTH,1);
	    long m=c.getTimeInMillis()/1000;
	    System.out.println(m);
	    return (int)m;
	    
    }
    public static Integer nowTime(){
    	
    	long m=new Date().getTime()/1000;
    	System.out.println(m);
    	return (int)m;
    	 
    }
    

}
